use crate::config::api_config::ApiResult;
use crate::entity::Page;
use crate::wechat::entity::wechat_user_type::WechatUserType;
use crate::wechat::service::wechat_user_type_service::WechatUserTypeService;
use salvo::{handler, Depot, Request};

#[handler]
#[tracing::instrument]
pub async fn page(request: &mut Request, depot: &mut Depot) -> ApiResult<Page<WechatUserType>> {
    let result = WechatUserTypeService::page(request, depot).await;
    ApiResult::from(result)
}

#[handler]
#[tracing::instrument]
pub async fn insert(request: &mut Request, depot: &mut Depot) -> ApiResult<()> {
    let result = WechatUserTypeService::insert(request, depot).await;
    ApiResult::from(result)
}

#[handler]
#[tracing::instrument]
pub async fn eidt(request: &mut Request, depot: &mut Depot) -> ApiResult<()> {
    let result = WechatUserTypeService::edit(request, depot).await;
    ApiResult::from(result)
}